local skel = fk.CreateSkill{
  name = "tea__tizheng_active&",
}
Fk:loadTranslationTable{
  ["tea__tizheng_active&"] = "放权",
  [":tea__tizheng_active&"] = "你可以跳过你的出牌阶段，然后此回合结束时，你可以弃置一张手牌并令拥有【替政】的角色获得一个额外回合。",
  ["tea__tizheng_active-card"] = "你须弃置一张手牌并令 %src 获得一个额外回合",
}
---@type TrigSkelSpec<EventPhaseChangingFunc>
local fangquan = {
  anim_type = "support",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(skel.name) and player.room.current == player and data.phase == Player.Play and not data.skipped
      and table.find(player.room:getOtherPlayers(player), function (p)
        return p:hasSkill("tea__tizheng")
      end)
  end,
  on_use = function (self, event, target, player, data)
    data.skipped = true
  end,
}
---@type TrigSkelSpec<TurnFunc>
local fangquan_delay = {
  mute = true,
  can_trigger = function(self, event, target, player, data)
    return target == player and player:usedSkillTimes(skel.name, Player.HistoryTurn) > 0 and
      not player.dead and not player:isKongcheng() and
      #player.room:getOtherPlayers(player, false) > 0
  end,
  on_cost = function (self, event, target, player, data)
    local room = player.room
    local tos = table.filter(room:getOtherPlayers(player), function (p)
      return p:hasSkill("tea__tizheng", true)
    end)
    if #tos == 1 and table.find(player:getCardIds("h"), function (id)
      return not player:prohibitDiscard(id)
    end) then
      local cards = room:askToCards(player, {
        min_num = 1,
        max_num = 1,
        pattern = ".|.|.|hand",
        prompt = "tea__tizheng_active-card:" .. tos[1].id,
        skill_name = skel.name,
        will_throw = true,
        cancelable = false, --fixme 欠缺考虑
      })
      if #tos > 0 and #cards > 0 then
        event:setCostData(self, {tos = tos, cards = cards})
        return true
      end
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local to = event:getCostData(self).tos[1]
    room:notifySkillInvoked(player, skel.name, "support", { to })
    room:throwCard(event:getCostData(self).cards, skel.name, player, player)
    if not to.dead then
      to:gainAnExtraTurn(true, skel.name)
    end
  end,
}
skel:addEffect(fk.EventPhaseChanging, fangquan)
skel:addEffect(fk.TurnEnd, fangquan_delay)
return skel